/*
 * @Author: Yanan Chen
 * @Date: 2021-11-02 13:39:49
 * @LastEditTime: 2021-11-08 13:52:52
 * @LastEditors: Yanan Chen
 * @Description: 
 * @FilePath: \esp32\Src\Hal\hal_adc.c
 * 
 */

#include <stdio.h>
#include <stdlib.h>
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/adc_common.h"
#include "hal_adc.h"

void adc_init()
{
    //ADC1 config
   adc1_config_width(ADC_WIDTH_BIT_12);
   adc1_config_channel_atten(POWER_ADC_CHANNEL, ADC_ATTEN_DB_0);
}



unsigned int adc_get()
{
    return adc1_get_raw(POWER_ADC_CHANNEL);
}
